//
// Created by kevin on 2024/12/3.
//

#include "tx_modulationQAM.h"
#include <math.h>


double* tx_modulationQAM(u8* inBinaryData, int len, int nModulationSymb, std::string PUSCH_tp_pi2BPSK){
    double *modulateData = new double[len];
    u8* pinDataReal = inBinaryData;
    u8* pinDataImag = &inBinaryData[1];
    int complex_len = len >> 1;
    switch(nModulationSymb){
        case 1:
        {
            break;
        }
        case 2: //qpsk
        {
            double coef = 1.0 / sqrt(2);
            for(int i = 0; i < complex_len; i++){
                modulateData[i] = 1 - 2*pinDataReal[i*2];
                modulateData[2*i+1] = 1 - 2*pinDataReal[i*2+1]*coef;
            }
            break;
        }
        case 4: //16-qam
        {
            break;
        }
        case 6:  //64-qam
        {
            break;
        }
        case 8:
        {
            break;
        }
        case 10:{
            break;
        }
        default:
        {
            std::cout << "Error in tx_modulationQAM. unknow modulation order ..." <<std::endl;
        }
    }

    return modulateData;

}